home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 11694 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: fsgi01.fnal.gov!not-for-mail
  2. From: b91926@fsgi01.fnal.gov (David Sachs)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Can you overload a constructor?
  5. Date: 15 Mar 1996 13:37:43 -0600
  6. Organization: FERMILAB, Batavia, IL
  7. Message-ID: <4icgu7$slv@fsgi01.fnal.gov>
  8. References: <Do859K.K9B@watserv3.uwaterloo.ca>
  9. Reply-To: sachs@fnal.fnal.gov
  10. NNTP-Posting-Host: fsgi01.fnal.gov
  11. X-Newsreader: NN version 6.5.0 #9 (NOV)
  12.  
  13. jfournie@sciborg.uwaterloo.ca () writes:
  14.  
  15. >Greetings,
  16.  
  17. >I am new to C++ and just wanted to make sure it
  18. >was OK to overload a constructor.  gnu c++
  19. >doesn't have a problem with it, but is it normally
  20. >done?
  21.  
  22. It is very normal to overload constructors. In fact
  23. most classes have at least 2 constructors, a constructor
  24. to build a class object out of something simpler (often
  25. nothing - This is called a default constructor), and
  26. a copy constructor, which makes a duplicate of an existing
  27. class object. If a class has only a single constructor in
  28. its declaration, chance are it also has a compiler generated
  29. copy constructor.
  30. -- 
  31. ***** Listen Americans, the IRS is your taxer,  the IRS is one. *****
  32. David Sachs - Fermilab, HPPC MS369 - P. O. Box 500 - Batavia, IL 60510
  33. Voice: 1 708 840 3942      Deparment Fax: 1 708 840 3785
  34.